#ifndef __ping_h
#define __ping_h

#include "sys.h"
#include "net.h"

enum{
    PING_SUCCESS = 0,
    PING_ERR_CREAT_SOCK,
    PING_ERR_SELECT,
    PING_ERR_IP_NONE,
    PING_ERR_NOT_REACH,
};

typedef struct{
    uint32_t ip;
    int counts;
    int timeout;// ms
    int blocksize;
}ping_arg_t;

typedef struct{
    double latency;
    double max_latency, min_latency;
    int snd_count;
    int rcv_count;
    double lost_percent, jitter;
}ping_result_t;

void* do_ping(void* _arg);
void ping_result_print(ping_result_t *result);
#endif